<?php

namespace app\controller;

use app\BaseController;

class Index extends BaseController
{


    public function index()
    {
        $unix_time = mktime(0, 0, 0, 8, 1, 2020);
        $mont_day = intval(date('t', $unix_time));
        $day = date('d');

        $week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
        $first_day_week = intval(date('w', $unix_time));
        $array = [];
        for ($i = 0; $i < $first_day_week; $i++) {
            $array[] = [
                'time' => '',
                'status' => 0
            ];
        }

        for ($j = 1; $j <= $mont_day; $j++) {
            if ($j == $day) {
                $array[] = [
                    'time' => $j,
                    'status' => 1
                ];
            } else {
                $array[] = [
                    'time' => $j,
                    'status' => 0
                ];
            }
        }
        $nums = 7 - (count($array) % 7);
        if ($nums > 0) {
            for ($ii = 0; $ii < $nums; $ii++) {
                $array[] = [
                    'time' => '',
                    'status' => 0
                ];
            }
        }

        $view = [
            'array' => $array,
            'week' => $week,
            'list' => [1, 2, 3]
        ];
        return view('', $view);
    }

    public function position()
    {
        return view();
    }
}
